  var sidebar = '\
    <el-aside style="background-color:#212529;width:200px;" >\
    <el-menu\
      v-bind:default-active="menuactive"\
      class="el-menu-vertical-demo"\
      background-color="#212529"\
      text-color="#b5b5b5"\
      active-text-color="#fff">\
	  <div v-for="(item,index1) in menu">\
		  <el-submenu v-bind:index="item.index" v-if="item.child.length>0" :key="item.index" v-on:click="action(item.url, item.index)">\
			<template slot="title">\
			  <i v-bind:class="item.iconclass"></i>\
			  <span >{{item.text}}</span>\
			</template>\
			  <el-menu-item index="subitem.index" v-for="(subitem,index2) in item.child" :key="subitem.index" v-on:click="action(subitem.url, subitem.index)">{{subitem.text}}</el-menu-item>\
		  </el-submenu>\
		  <el-menu-item v-bind:index="item.index" v-if="item.child.length==0" :key="item.index" v-on:click="action(item.url, item.index)">\
			<i v-bind:class="item.iconclass"></i>\
			<span slot="title">{{item.text}}</span>\
		  </el-menu-item>\
		</div>\
    </el-menu>\
	</el-aside>\
  '

// 定义一个新组件
var sidebar_obj = Vue.component('sidebar', {
	data: function () {
		return {
			menuactive:'1'
		}
	},
	methods: {
	  action: function (url,index) {
		this.menuactive = index;
		
		Event.$emit("urlevent", url);
	  }
	},
	props: ['menu'],
	template: sidebar
})